<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father{
            width: 400px;
            height: 400px;
            margin: 100px auto;

            background-color: pink;
        }
        .son{
            width: 200px;
            height: 200px;
            background-color: red;
            transition: all 1s;

        }

        .father:hover .son{
            transform: translate(100px, 100px);
            
            /* 百分比：参照盒子自身尺寸计算结果 */
            transform: translate(50%,100%);
            transform: translate(-50%,100%);

            /* 只写一个数表示水平方向 */
            transform: translate(100px);
            /* 只写一个数表示垂直方向 */
            transform: translateY(100px);

        }
    </style>

</head>
<body>
    <div class="father">
        <div class="son"></div>
    </div>
</body>
</html>